package com.example.last.service;

import cn.hutool.core.util.ObjectUtil;
import com.example.last.common.enums.ErrorCode;
import com.example.last.dao.AdminDao;
import com.example.last.dao.AuditDao;
import com.example.last.dao.TestDao;
import com.example.last.entity.Account;
import com.example.last.entity.Audit;
import com.example.last.entity.Params;
import com.example.last.entity.Test;
import com.example.last.exception.CustomException;
import com.example.last.utils.JwtTokenUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TestService {
    @Resource
    private TestDao testDao;

    public PageInfo<Test> findBySearch(@Param("params") Params params){
        //开启分页查询
        PageHelper.startPage(params.getPageNum(),params.getPageSize());
        List<Test> list =  testDao.findBySearch(params);
        return PageInfo.of(list);
    }

    public void add(Test test){
        testDao.add(test);
    }

    public void update(Test test){
        testDao.update(test);
    }

    public void delete(Integer id){
        testDao.delete(id);
    }


}
